var chart1 = new FusionCharts("charts/column/Column2D.swf", "ChartId1", "100%", "100%");
chart1.setXMLData("<chart palette='2' chartLeftMargin='0' yAxisMaxValue='100' chartRightMargin='8' yAxisValueStep='2' bgSWF='images/bb_bg.png' NumberSuffix='%' useRoundEdges='1' labelDisplay='WRAP'> <set label='12月' value='85' color='#4673A7' toolText='设备开机率 ：85%'/> <set label='11月' value='90' color='#4673A7' toolText='设备开机率 ：90%'/> <set label='10月' value='80' color='#4673A7' toolText='设备开机率 ：80%'/> </chart>");	   
chart1.render("chart1");

var chart2 = new FusionCharts("charts/column/MSCombiDY2D.swf", "ChartId2", "100%", "100%");
chart2.setXMLData("<chart showValues='0' chartLeftMargin='0' chartRightMargin='8' useRoundEdges='1' bgSWF='images/bb_bg.png' legendPosition='Right' decimals='3' setAdaptiveYMin='1' setAdaptiveSYMin='1' lineThickness='5'> <categories> <category label='12月' /> <category label='11月' /> <category label='10月' />  </categories> <dataset parentYAxis='P' seriesname='里程Km' color='#4673A7'> <set value='1236' color='#4673A7'/> <set value='2341' color='#4673A7'/> <set value='1658' color='#4673A7'/>  </dataset> <dataset parentYAxis='S' seriesname='油耗L' renderAs='Column' color='#AA4744'> <set value='247.2' color='#AA4744'/> <set value='316.5' color='#AA4744'/> <set value='120.6' color='#AA4744'/>  </dataset> </chart>");	   
chart2.render("chart2");

var chart3 = new FusionCharts("charts/column/Column2D.swf", "ChartId3", "100%", "100%");
chart3.setXMLData("<chart palette='2' chartLeftMargin='0' chartRightMargin='8' yAxisValueStep='2' NumberSuffix='台' bgSWF='images/bb_bg.png' useRoundEdges='1' labelDisplay='WRAP'> <set label='大于12小时' value='26' color='#4673A7' toolText='运行时间大于12小时的设备 ：26台'/> <set label='大于8小时' value='41' color='#4673A7' toolText='运行时间大于8小时的设备 ：41台'/> <set label='大于4小时' value='11' color='#4673A7' toolText='运行时间大于4小时的设备 ：11台'/> </chart>");	   
chart3.render("chart3");
var charts = new Array(chart1,chart2,chart3);
var chart;
$(function(){
	var i = 0;
	$(".leftArrows").click(function(){
		if(i==0){
			for(var j = 0;j<charts.length;j++){
				chart = charts[j];
				var chartData = chart.getXMLData();
				chartData = chartData.replace('images/bb_bg','images/bb_bg_');
				chart.setXMLData(chartData);
				chart.render("chart"+eval(j+1));
			}
			i = 1;
		}else{
			for(var j = 0;j<charts.length;j++){
				chart = charts[j];
				var chartData = chart.getXMLData();
				chartData = chartData.replace('images/bb_bg_','images/bb_bg');
				chart.setXMLData(chartData);
				chart.render("chart"+eval(j+1));
			}
			i = 0;
		}
	});
});